package com.kapcb.assemble;

import com.kapcb.assemble.filter.DefaultFilterExecutor;
import com.kapcb.assemble.filter.FilterAssembleExecutor;
import com.kapcb.assemble.strategy.DefaultStrategySelector;
import com.kapcb.assemble.strategy.IStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * <a>Title: DefaultAssembleAutoConfiguration </a>
 * <a>Author: cb <a>
 * <a>Description: DefaultAssembleAutoConfiguration <a>
 *
 * @author cb
 * @version 1.0
 * @date 2024/4/18 10:15 AM
 * @since 1.0
 */
@Slf4j
@Configurable
public class AssembleAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(value = DefaultStrategySelector.class)
    public IStrategy strategy() {
        if (log.isDebugEnabled()) {
            log.debug("begin load DefaultStrategySelector into IOC ......");
        }
        return new DefaultStrategySelector();
    }

    @Bean
    @ConditionalOnMissingBean(value = DefaultFilterExecutor.class)
    public FilterAssembleExecutor filterAssembleExecutor() {
        if (log.isDebugEnabled()) {
            log.debug("begin load DefaultFilterExecutor into IOC ......");
        }
        return new DefaultFilterExecutor();
    }

}